import validate from '../../utils/Validation'

// 校验规则
const SCHEMA = {
    type: "object",
    required: ["code", "password","nickName","email"],
    properties: {
        code: {
            type: 'string',
            maxLength: 6,
            minLength: 6
        },
        password: {
            type: 'string',
            maxLength: 255,
            minLength: 6
        },
        nickName: {
            type: 'string',
            maxLength: 255,
            minLength: 5
        },
        email: {
            type: 'string',
            pattern: '^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$'
        }
    }
}

function validation(data = {}){
    return validate(SCHEMA, data)
}
export default validation